<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 列出1~10000的所有质数 */
        var time;
        time = 0;
        for(var i = 2; i <= 10000; i++) {
            for(var j = 1; j <= i; j++) {
                if( i % j == 0) {
                    time += 1;
                }
            }
            if( time == 2) {
                console.log(i);
            }
            time = 0;
        }
        
    </script>
</body>
</html>